package dletc.job.job01;

public class China_teacher {
	
	int x = 10;
	int y = 10;
	
	LiaoNing liaoNing = new LiaoNing();
	
	//外部类用内部类的属性和方法 需要调用 “引用.” 或  “类名.”
	public void f(){
		
		System.out.println("我是中国");
		liaoNing.speak();
	}
	
	//内部类用外部类的属性和元素可直接使用
	 class LiaoNing{
		int z = 10;
		
		public void g(){
			z = x + y;
			f();
		}
		
		public void speak(){
			System.out.println("我是大连，z =" + z);
		}
		
	}

	public static void main(String[] args) {
		
		China_teacher c = new China_teacher();
		c.f();
		
		c.liaoNing.g();

	}

}
